﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CanDoo.Data.Entity;
using CanDoo.Oil.Core.Models;

namespace CanDoo.Oil.Core.ModelConfigurations
{
    /// <summary>
    /// 实体类-数据表映射——客户退货单
    /// </summary>
    public class OutSellBackConfiguration : EntityConfigurationBase<OutSellBack>
    {
        /// <summary>
        /// 初始化一个<see cref="OutSellBackConfiguration"/>类型的新实例
        /// </summary>
        public OutSellBackConfiguration()
        {
             ToTable("sell_OutSellBack");
             this.Property(p => p.OutStoreId).HasColumnName("OutStoreId");
             this.HasOptional(p => p.OutStore).WithMany().HasForeignKey(p => p.OutStoreId).WillCascadeOnDelete(false);

             this.Property(p => p.UserId).HasColumnName("UserId");
             this.HasRequired(p => p.User).WithMany().HasForeignKey(p => p.UserId).WillCascadeOnDelete(false);

             this.Property(p => p.CustomerId).HasColumnName("CustomerId");
             this.HasRequired(p => p.Customer).WithMany().HasForeignKey(p => p.CustomerId).WillCascadeOnDelete(false);

             this.Property(p => p.WarehouseId).HasColumnName("WarehouseId");
             this.HasRequired(p => p.Warehouse).WithMany().HasForeignKey(p => p.WarehouseId).WillCascadeOnDelete(false);

            //this.HasMany(p => p.OutSellBackDetails).WithOptional(p => p.OutSellBack).HasForeignKey(p => p.OutSellBackId).WillCascadeOnDelete(true);
        }
    }
}
